//
//  JWNewsPicturCell.m
//  JWMovie
//
//  Created by Jorn.Wu on 15/7/21.
//  Copyright (c) 2015年 Jorn.Wu. All rights reserved.
//

#import "JWNewsPictureCell.h"
#import "JWNewsPictureModel.h"
#import "UIImageView+WebCache.h"

@interface JWNewsPictureCell ()

@property (nonatomic, strong) UIImageView *image;
@end

@implementation JWNewsPictureCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        //        电影图片
        
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
        imageView.layer.borderWidth = 1.f;
        imageView.layer.borderColor = [UIColor whiteColor].CGColor;
        imageView.layer.cornerRadius = 8.f;
        imageView.layer.masksToBounds = YES;
        [self.contentView addSubview:imageView];
        _image = imageView;
    
    }
    return self;
}

- (void)setNewsPictureModel:(JWNewsPictureModel *)newsPictureModel{
    _newsPictureModel = newsPictureModel;
    
    NSString *urlStr = newsPictureModel.image;
    [self.image sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:[UIImage imageNamed:@"sctpxw@2x"]];
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
}

+ (instancetype)newsPictureCellWithCollectionView:(UICollectionView *)collectionView ReuseIdentifier:(NSString *)identifier indexPath:(NSIndexPath *)indexPath{
    
    JWNewsPictureCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];

    return cell;
}

@end
